package com.cnhis.cloudhealth.clidoctorweb.clinicalreceptiontransfer;

import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.jboss.resteasy.logging.Logger;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Reference;
import com.cnhis.cloudhealth.clinical.clidoctor.clinicalreceptiontransfer.service.IClinicalReceptionTransfer;
import com.cnhis.cloudhealth.commons.Mappers.ModelVo;
import java.util.HashMap;
@Path("clinicalreceptiontransfer")
@Component
public class ClinicalReceptionTransferRest {
	Logger log = Logger.getLogger(ClinicalReceptionTransferRest.class); 
	@Reference
	private IClinicalReceptionTransfer iClinicalReception;
	/**656
	 * 用于候诊病人转接诊病人
	 * @param BCK01A 执行科室ID
	 * @param BCE03A 执行者医师
	 * @param BCE02A 执行者号
	 * @param BCE01A 医生ID
	 * @param VAC01  就诊ID
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("waitingtoreception")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo waitingToReception(@FormParam("BCK01A") Integer BCK01A,@FormParam("BCE03A") String BCE03A,@FormParam("BCE02A") String BCE02A,@FormParam("BCE01A") Integer BCE01A,@FormParam("VAC01") Integer VAC01) throws Exception{
		HashMap hs = new HashMap();
		hs.put("BCK01A", BCK01A);
		hs.put("BCE03A", BCE03A);
		hs.put("BCE02A", BCE02A);
		hs.put("BCE01A", BCE01A);
		hs.put("VAC01", VAC01);
		return iClinicalReception.waitingToReception(hs);
	}
	
	
	/**658
	 * 用于完成接诊病人
	 * @param VAC01 就诊ID
	 * @param VAC34 执行状态
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("finishedreception")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo finishedReception(@FormParam("VAC01") Integer VAC01,@FormParam("VAC34") Integer VAC34)throws Exception{
		HashMap hs = new HashMap();
		hs.put("VAC01", VAC01);
		hs.put("VAC34", VAC34);
		return iClinicalReception.finishedReception(hs);
	}
	
	
	/**659
	 * 用于取消接诊 病人
	 * @param VAC01 就诊ID
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("cancelreception")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo cancelReception(@FormParam("VAC01") Integer VAC01)throws Exception{
		HashMap hs = new HashMap();
		hs.put("VAC01", VAC01);
		return iClinicalReception.cancelReception(hs);
	}
	
	
	/**1740
	 * 判断此号是否已接诊或已退号
	 * @param VAC01 就诊ID
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("receptionorquit")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo receptionOrQuit(@FormParam("VAC01") Integer VAC01)throws Exception{
		HashMap hs = new HashMap();
		hs.put("VAC01", VAC01);
		return iClinicalReception.receptionOrQuit(hs);
	}
	
	/**1714
	 * 医师接诊时，修改vaa1表中的接诊时间、科室
	 * @param BCK01A 接诊科室ID
	 * @param VAA01  病人ID
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("updateclinicalreception")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo updateClinicalReception(@FormParam("BCK01A") Integer BCK01A,@FormParam("VAA01") Integer VAA01)throws Exception{
		HashMap hs = new HashMap();
		hs.put("VAA01", VAA01);
		hs.put("BCK01A", BCK01A);
		return iClinicalReception.updateClinicalReception(hs);
	}
	/**1716
	 * 用于门诊病人院内转诊，检索门诊临床科室
	 * @param BAU01 岗位分类
	 * @param ACF01 业务分类
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("selectclinicaloffice")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo selectClinicalOffice(@FormParam("BAU01") String BAU01,@FormParam("ACF01") Integer ACF01,@FormParam("currPage") int currPage,@FormParam("pageSize") int pageSize)throws Exception{
		HashMap hs = new HashMap();
		hs.put("BAU01", BAU01);
		hs.put("ACF01", ACF01);
		return iClinicalReception.selectClinicalOffice(hs, (currPage-1)*pageSize, pageSize);
	}
	/**1717
	 * 用于门诊病人转诊，判断是否还有没结帐医嘱
	 *  lACF01  --门诊 住院 
     *  lVAA01  --病人id
      *  lVAA07   --就诊id 主页id
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("hassettledoctoradvice")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo hasSettleDoctorAdvice(@FormParam("lACF01") int lACF01,@FormParam("lVAA01") int lVAA01,@FormParam("lVAA07") int lVAA07,@FormParam("currPage") int currPage,@FormParam("pageSize") int pageSize)throws Exception{
		HashMap hs = new HashMap();
		hs.put("lACF01", lACF01);
		hs.put("lVAA01", lVAA01);
		hs.put("lVAA07", lVAA07);
		return iClinicalReception.hasSettleDoctorAdvice(hs, (currPage-1)*pageSize, pageSize);
	}
	/**1763
	 * 判断病人就诊时间是否在有效期内
	 * @param VAC01 就诊id
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("visittimewhethervalidity")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo visittimeWhetherValidity(@FormParam("VAC01") int VAC01)throws Exception{
		HashMap hs = new HashMap();
		hs.put("VAC01", VAC01);
		
		return iClinicalReception.visittimeWhetherValidity(hs);
	}
	/**2117
	 * 检索本人已诊病人
	 * @param lVAC34 执行状态
	 * @param lBCE01 医师id
	 * @param lDt1 开始时间
	 * @param lDt2  结束时间
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("personalfinishedpatient")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo personalFinishedPatient(@FormParam("lVAC34") int lVAC34,@FormParam("lBCE01") int lBCE01,@FormParam("lDt1") String lDt1,@FormParam("lDt2") String lDt2,@FormParam("currPage") int currPage,@FormParam("pageSize") int pageSize)throws Exception{
		HashMap hs = new HashMap();
		hs.put("lVAC34", lVAC34);
		hs.put("lBCE01", lBCE01);
		hs.put("lDt1", lDt1+" 00:00:00.000");
		hs.put("lDt2", lDt2+" 23:59:59.999");
		return iClinicalReception.personalFinishedPatient(hs, (currPage-1)*pageSize, pageSize);
	}
	/**7489
	 * 转诊，根据科室查找诊室
	 * @param BCK01 科室
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("queryconsultingroombyadministrativeoffice")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo queryConsultingRoomByAdministrativeOffice(@FormParam("BCK01") int BCK01)throws Exception{
		HashMap hs = new HashMap();
		hs.put("BCK01", BCK01);
		return iClinicalReception.queryConsultingRoomByAdministrativeOffice(hs);
	}
	/**7265
	 * 转诊，根据科室查找医师
	 * @param BCK01 科室
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("querydoctorbyadministrativeoffice")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo queryDoctorByAdministrativeOffice(@FormParam("BCK01") int BCK01)throws Exception{
		HashMap hs = new HashMap();
		hs.put("BCK01", BCK01);
		return iClinicalReception.queryDoctorByAdministrativeOffice(hs);
	}
	//Clinic_VAC1_Update
	//接诊
	/**
	 * 
	 * @param lVAA07 就诊id
	 * @param lVAA01 病人id
	 * @param lBCK01 部门id
	 * @param lBCE01 员工id
	 * @param lBCE02 员工编号
	 * @param lBCE03 员工姓名
	 * @param lSign  0 接诊 1 取消接诊
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("clinicvac1update")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo clinicVAC1Update(
			@FormParam("lVAA07") long lVAA07,
			@FormParam("lVAA01") long lVAA01,
			@FormParam("lBCK01") int lBCK01,
			@FormParam("lBCE01") long lBCE01,
			@FormParam("lBCE02") String lBCE02,
			@FormParam("lBCE03") String lBCE03,
			@FormParam("lSign") int lSign
			)throws Exception{
		HashMap hs = new HashMap();
		hs.put("lVAA07", lVAA07);
		hs.put("lVAA01", lVAA01);
		hs.put("lBCK01", lBCK01);
		hs.put("lBCE01", lBCE01);
		hs.put("lBCE02", lBCE02);
		hs.put("lBCE03", lBCE03);
		hs.put("lSign", lSign);
		return iClinicalReception.clinicVAC1Update(hs);
	}
	//Clinic_Change_BCK1
	//门诊转诊
	/**
	 * 
	 * @param lVAC01 就诊id
	 * @param lBCK01 科室id
	 * @param lBCE01 员工id
	 * @param lBCE03 员工姓名
	 * @param lBCE01A
	 * @param BAS02 诊室名称
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("clinicchangebck1")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo clinicChangeBCK1(
			@FormParam("lVAC01") long lVAC01,
			@FormParam("lBCK01")  long lBCK01,
			@FormParam("lBCE01") long lBCE01,
			@FormParam("lBCE03") String lBCE03,
			@FormParam("lBCE01A") long lBCE01A,
			@FormParam("lBCK01A") int lBCK01A,
			@FormParam("BAS02") String BAS02
			)throws Exception{
		HashMap hs = new HashMap();
		hs.put("lVAC01", lVAC01);
		hs.put("lBCK01", lBCK01);
		hs.put("lBCE01", lBCE01);
		hs.put("lBCE03", lBCE03);
		hs.put("lBCE01A", lBCE01A);
		hs.put("BAS02", BAS02);
		hs.put("lBCK01A", lBCK01A);
		return iClinicalReception.clinicChangeBCK1(hs);
	}
}
